package com.woniuxy.caradmin.controller;

import com.sun.org.apache.xpath.internal.operations.Mod;
import com.sun.org.apache.xpath.internal.operations.Mod;
import com.woniuxy.caradmin.entity.pojo.Dept;
import com.woniuxy.caradmin.entity.pojo.User;
import com.woniuxy.caradmin.entity.pojo.Yearcheckrecord;
import com.woniuxy.caradmin.service.DeptService;
import com.woniuxy.caradmin.service.UserService;
import com.woniuxy.caradmin.service.YearcheckrecordService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Controller
public class JumpController {
    @Autowired
    private UserService userService;
@Autowired
private YearcheckrecordService yearcheckrecordService;
    //跳转用户界面
    @ApiOperation("跳转用户界面")
    @RequestMapping("/gouserList")
    public String gouserList(){
        System.out.println("fsfsd");
        return "userList";
    }
    //跳转到角色列表
    @ApiOperation("跳转到角色列表")
    @RequestMapping("/rolelist")
    public ModelAndView Role(ModelAndView modelAndView){
        modelAndView.setViewName("rolelist");
        return modelAndView;
    }
    //跳转到驾驶员档案列表
    @ApiOperation("跳转到驾驶员档案列表")
    @RequestMapping("/driverlist")
    public ModelAndView driver(ModelAndView modelAndView){
        modelAndView.setViewName("driverlist");
        return modelAndView;
    }
    //跳转违章记录页面
    @RequestMapping("/gobreak")
    public ModelAndView gobreak(ModelAndView modelAndView) {
        modelAndView.setViewName("breakrulerecord");
        return modelAndView;
    }
    //跳转事故记录页面
    @RequestMapping("/gotrouble")
    public ModelAndView gotrouble(ModelAndView modelAndView) {
        modelAndView.setViewName("troublerecord");
        return modelAndView;
    }
    //跳转年检记录页面
    @RequestMapping("/goyear")
    public ModelAndView goyear(ModelAndView modelAndView) {
        modelAndView.setViewName("yearcheckrecord");
        return modelAndView;
    }
    //跳转保险记录页面
    @RequestMapping("/goinsure")
    public ModelAndView goinsure(ModelAndView modelAndView) {
        modelAndView.setViewName("insurerecord");
        return modelAndView;
    }
    //跳转更新年检记录页面
    @RequestMapping("/goupyear")
    public ModelAndView goupyear(ModelAndView modelAndView) {
        modelAndView.setViewName("upyearcheckrecord");
        return modelAndView;
    }
    //跳转增加违章记录页面
    @RequestMapping("/goaddbreak")
    public ModelAndView goaddbreak(ModelAndView modelAndView) {
        modelAndView.setViewName("addbreakrecord");
        return modelAndView;
    }
    //跳转增加年检记录页面
    @RequestMapping("/goaddyear")
    public ModelAndView goaddyear(ModelAndView modelAndView) {
        modelAndView.setViewName("addyearcheckrecord");
        return modelAndView;
    }
    //跳转增加事故记录页面
    @RequestMapping("/goaddtrouble")
    public ModelAndView goaddtrouble(ModelAndView modelAndView) {
        modelAndView.setViewName("addtroublerecord");
        return modelAndView;
    }
    //跳转增加保险记录页面
    @RequestMapping("/goaddinsure")
    public ModelAndView goaddinsurerecord(ModelAndView modelAndView) {
        modelAndView.setViewName("addinsurerecord");
        return modelAndView;
    }
    //跳转至到期提醒页面
    @RequestMapping("/remind")
    public ModelAndView remind(ModelAndView modelAndView){
        modelAndView.setViewName("remind");
        return modelAndView;
    }
    //跳转至车辆状态页面
    @RequestMapping("/carstatus")
    public ModelAndView carstatus(ModelAndView modelAndView){
        modelAndView.setViewName("carstatus");
        return modelAndView;
    }
    //跳转至增加车辆页面
    @RequestMapping("/goAddVehiclefile")
    public ModelAndView goAddVehiclefile(ModelAndView modelAndView){
        modelAndView.setViewName("addVehiclefile");
        return modelAndView;
    }
    //跳转至修改车辆页面
    @RequestMapping("/goUpdateVehiclefile")
    public ModelAndView goUpdateVehiclefile(ModelAndView modelAndView){
        modelAndView.setViewName("updateVehiclefile");
        return modelAndView;
    }
    //跳转至车辆详情页面
    @RequestMapping("/goDetailVehiclefile")
    public ModelAndView goDetailVehicle(ModelAndView modelAndView){
        modelAndView.setViewName("detailVehiclefile");
        return modelAndView;
    }
    //跳转到用户角色分配页面
    @ApiOperation("跳转到用户角色分配页面")
    @RequestMapping("/goRoles")
    public ModelAndView goRoles(ModelAndView modelAndView){
        modelAndView.setViewName("userRole");
        return modelAndView;
    }
    //跳转到角色分配权限页面
    @ApiOperation("跳转到角色分配权限页面")
    @RequestMapping("/gorolePermiss")
    public ModelAndView gorolePermiss(ModelAndView modelAndView){
        modelAndView.setViewName("gorolePermiss");
        return modelAndView;
    }
    //跳转用户增加页面
    @RequestMapping("/adduser")
    @ApiOperation("跳转用户增加页面")
    public ModelAndView adduser(ModelAndView modelAndView){
        modelAndView.setViewName("adduser");
        return modelAndView;
    }
    //跳转用户修改页面
    @RequestMapping("/updateuser/{id}")
    @ApiOperation("跳转用户修改页面")
    public ModelAndView updateuser(@PathVariable("id") String id, ModelAndView modelAndView, HttpServletRequest request){
        System.out.println("+++"+id);
        User user = userService.selectUserByid(Integer.parseInt(id));
        request.setAttribute("name",user.getName());
        System.out.println(user);
        modelAndView.setViewName("updateuser");
        return modelAndView;
    }
    //跳转角色增加页面
    @RequestMapping("/addrole")
    @ApiOperation("跳转角色增加页面")
    public ModelAndView addrole(ModelAndView modelAndView){
        modelAndView.setViewName("addrole");
        return modelAndView;
    }
    //跳转角色修改页面
    @RequestMapping("/updrole")
    @ApiOperation("跳转角色修改页面")
    public ModelAndView updrole(ModelAndView modelAndView){
        modelAndView.setViewName("updrole");
        return modelAndView;
    }

    //跳转更新违章事故记录页面
    @RequestMapping("/goupbreak")
    public ModelAndView goupbreak(ModelAndView modelAndView) {
        modelAndView.setViewName("upbreakrulerecord");
        return modelAndView;
    }
    //跳转更新保险记录页面
    @RequestMapping("/goupinsure")
    public ModelAndView goupinsure(ModelAndView modelAndView) {
        modelAndView.setViewName("upinsurerecord");
        return modelAndView;
    }
    //跳转更新事故记录页面
    @RequestMapping("/gouptrouble")
    public ModelAndView gouptrouble(ModelAndView modelAndView) {
        modelAndView.setViewName("uptroublerecord");
        return modelAndView;
    }
    //跳转报表页面
    @RequestMapping("/gobaobiao")
    public ModelAndView gobaobiao(ModelAndView modelAndView) {

        modelAndView.setViewName("baobiao");
        return modelAndView;
    }


    //1 跳转到加油记录页面
    @RequestMapping("/goOilRecord")
    @ApiOperation("跳转到加油记录页面")
    public ModelAndView gooilrecord(ModelAndView modelAndView) {
        modelAndView.setViewName("oilrecord");
        return modelAndView;
    }

    //跳转到加油记录增加的页面
    @RequestMapping("/goaddOilRecord")
    @ApiOperation("跳转到加油记录的增加页面")
    public ModelAndView goaddoilrecord(ModelAndView modelAndView){
        modelAndView.setViewName("addoilrecord");
        return modelAndView;
    }

    //跳转加油记录修改页面
    @RequestMapping("/goupoilrecord")
    public ModelAndView goupoilbreak(ModelAndView modelAndView) {
        modelAndView.setViewName("upoilrecord");
        return modelAndView;
    }

    //2 跳转到维修记录展示页面
    @GetMapping("/goRepairRecord")
    @ApiOperation("跳转到维修记录展示页面")
    public ModelAndView gorepairrecord(ModelAndView modelAndView) {
        modelAndView.setViewName("repairrecord");
        return modelAndView;
    }

    //跳转到维修记录增加页面
    @RequestMapping("/goaddrepairrecord")
    @ApiOperation("跳转到加油记录的增加页面")
    public ModelAndView goaddrepairrecord(ModelAndView modelAndView){
        modelAndView.setViewName("addrepairrecord");
        return modelAndView;
    }

    //跳转维修记录修改页面
    @RequestMapping("/gouprepairrecord")
    public ModelAndView gouprepairrecord(ModelAndView modelAndView) {
        modelAndView.setViewName("uprepairrecord");
        return modelAndView;
    }

    //3 跳转到规费记录展示页面
    @GetMapping("/goFeeRecord")
    @ApiOperation("跳转到规费记录展示页面")
    public ModelAndView gofeerecord(ModelAndView modelAndView) {
        modelAndView.setViewName("feerecord");
        return modelAndView;
    }

    //跳转到规费记录增加页面
    @RequestMapping("/goaddfeerecord")
    @ApiOperation("跳转到规费记录的增加页面")
    public ModelAndView goaddfeerecord(ModelAndView modelAndView){
        modelAndView.setViewName("addfeerecord");
        return modelAndView;
    }


    //跳转规费记录修改页面
    @RequestMapping("/goupfeerecord")
    public ModelAndView goupfeerecord(ModelAndView modelAndView) {
        modelAndView.setViewName("upfeerecord");
        return modelAndView;
    }

    //4 跳转到保养记录展示页面
    @GetMapping("/goMaintainRecord")
    @ApiOperation("跳转到保养记录展示页面")
    public ModelAndView gomaintainrecord(ModelAndView modelAndView) {
        modelAndView.setViewName("maintainrecord");
        return modelAndView;
    }

    //跳转到保养记录增加页面
    @RequestMapping("/goaddmaintainrecord")
    @ApiOperation("跳转到保养记录的增加页面")
    public ModelAndView goaddmaintainrecord(ModelAndView modelAndView){
        modelAndView.setViewName("addmaintainrecord");
        return modelAndView;
    }

    //跳转保养记录增加页面
    @RequestMapping("/goupmaintainrecord")
    public ModelAndView goupmaintainrecord(ModelAndView modelAndView) {
        modelAndView.setViewName("upmaintainrecord");
        return modelAndView;
    }

    //跳转大日常报表
    @RequestMapping("/godailyreport")
    @ApiOperation("跳转到日常报表")
    public  ModelAndView godailyreport(ModelAndView modelAndView){
        modelAndView.setViewName("dailyreport");
        return modelAndView;
    }

    //跳转至车辆照片页面
    @RequestMapping("/goImgmanaVehiclefile")
    public ModelAndView goImgmanaVehiclefile(ModelAndView modelAndView){
        modelAndView.setViewName("imgmanaVehiclefile");
        return modelAndView;
    }
    //跳转至增加单位页面
    @RequestMapping("/goAddUnit")
    public ModelAndView goAddUnit(ModelAndView modelAndView){
        modelAndView.setViewName("addUnit");
        return modelAndView;
    }
    //跳转至更新单位页面
    @RequestMapping("/goUpdateUnit")
    public ModelAndView goUpdateUnit(ModelAndView modelAndView){
        modelAndView.setViewName("updateUnit");
        return modelAndView;
    }
    //跳转至单位详情页面
    @RequestMapping("/goDetailUnit")
    public ModelAndView goDetailUnit(ModelAndView modelAndView){
        modelAndView.setViewName("detailUnit");
        return modelAndView;
    }
}
